//
//  SMSRequestProvider.m
//  SulitLoan
//
//  Created by 虞嘉伟 on 2025/2/26.
//  
  

#import "ChangeBankCardRequestProvider.h"
#import "ChangeBankCardRequest.h"

@implementation ChangeBankCardRequestProvider

+ (void)requestChangeBankCardWithCardNumber:(NSString *)cardNumber orderNumber:(NSString *)orderNumber success:(void(^)(NSDictionary *dict))success failure:(void(^)(YTKRequest *request))failure {
    ChangeBankCardRequest *request = [ChangeBankCardRequest new];
    request.antvorskov = cardNumber;
    request.rehearsals = orderNumber;
#ifdef DEBUG
//    request.antvorskov = @"";
//    request.rehearsals = @"";
#endif
    [request startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
        NSDictionary *dict = request.responseObject;
        if (![dict isKindOfClass:NSDictionary.class]) {
            !failure ?: failure(request);
            return;
        }
        if ([dict[@"weeps"] intValue] == 0) {
            // 成功
            NSDictionary *bounding = dict[@"bounding"];
            !success ?: success(bounding);
        } else {
            !failure ?: failure(request);
        }
    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        !failure ?: failure(request);
    }];
}

@end
